﻿Ext.define('Admin.view.orderManage.OrderManageGrid', {
	extend: 'Ext.grid.Panel',
	id: 'orderManageGrid',
	xtype: 'orderManagegrid',
	title: '订单列表',
	iconCls: 'x-fa fa-file-text',
	//cls: 'user-grid',

	controller: 'orderManage',			//视图控制器
	viewModel: { type: 'orderManage' },	//视图数据模型
	bind: '{orderManageGridStore}',		//viewModeld的store
	//sm:new Ext.grid.CheckboxSelectionModel(),
	selModel: {
		selType: 'checkboxmodel',
		//checkOnly: true,
		showHeaderCheckbox: true
	},
	columns: [
		{ header: '申请人', dataIndex: 'userName', width: 80, sortable: true }
		, { header: '部门', dataIndex: 'departmentName', width: 60, sortable: true }
		, { header: '晚餐', dataIndex: 'dinner', width: 50, sortable: true }
		, { header: '宵夜', dataIndex: 'nightSnack', width: 50, sortable: true }
		, { header: '次日早餐', dataIndex: 'breakfast', width: 75, sortable: true }
		, { header: '次日午餐', dataIndex: 'lunch', width: 75, sortable: true }
		, { header: '审批人', dataIndex: 'approver', width: 180, sortable: true }
		, { header: '审批时间', dataIndex: 'approvalTime', width: 495, sortable: true, renderer: Ext.util.Format.dateRenderer('Y/m/d H:i:s') }
	],
	dockedItems: [
		{
			xtype: 'pagingtoolbar',
			dock: 'bottom',
			bind: '{orderManageGridStore}',	//viewModeld的store
			displayInfo: true,
			displayMsg: '显示第 {0} - {1} 条数据 总计 {2}',
			emptyMsg: "没有任何数据",
			items: ['-', {
				text: '导出Excel',
				iconCls: 'x-fa fa-arrow-down',
				listeners: {
					click: 'onClickPrintExcel'
				}
			}]
		}, {
			xtype: 'toolbar',
			dock: 'top',
			items: [{
				xtype: 'combobox',
				reference: 'orderGridSearchField', //查询条件下拉列表
				store: Ext.create('Ext.data.Store', {
					fields: ['value', 'name'],
					data: [//查询条件字段名和展示名
						{ "value": 'departmentName', "name": '部门' },
						{ "value": 'userName', "name": '申请人' },
						{ "value": 'approvalTime', "name": '日期' }
					]
				}),
				mode: 'local',
				editable: false,
				allowBlank: false,
				emptyText: '查找条件',
				queryMode: 'local',
				valueField: 'value',
				displayField: 'name'
			}, {
				xtype: 'textfield',
				reference: 'orderGridSearchText'//查询值文本框
			}, {
				labelAlign: 'right',
				fieldLabel: '时间段',
				xtype: 'datefield',
				format: 'Y-m-d',
				name: 'startTime',
				reference: 'startTime'
			}, {
				xtype: 'datefield',
				format: 'Y-m-d',
				name: 'endTime',
				reference: 'endTime'
			}, {
				text: '快捷查询',
				listeners: {
					click: 'orderGridPanelQuickSearch'//快捷查询按钮
				}
			}
			]
		}
	]
});